{include file="public/header"/}
<link rel="stylesheet" href="{__PUBLIC_PATH}/admin/pcf/pcfbase.css?v={$version}"/>
</head>
<body>
<div class="layui-form">
<div class="layui-fluid">
<div class="layui-col-sm12">
<div class="layui-card pcf30">
<div style="width:100%;height:100%;max-width:600px;">
    <input type="hidden" name="role_id" value="{$manageInfo.role_id}"/>
    <input type="hidden" name="admin_id" value="{$manageInfo.admin_id}"/>
    <input type="hidden" name="user_name" value="{$manageInfo.user_name}"/>
    <div class="layui-form-item">
        <label class="layui-form-label">账号:</label>
        <div class="layui-input-block" style="line-height:36px;color:red;">
            {$manageInfo.user_name}
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">密码:</label>
        <div class="layui-input-block">
            <input name="password"  type="password" class="layui-input" maxlength="20" lay-verType="tips"/>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">昵称:</label>
        <div class="layui-input-block">
            <input name="pen_name" placeholder="请输入昵称" value="{if $manageInfo}{$manageInfo.pen_name}{else/}{/if}" type="text" class="layui-input" maxlength="20" lay-verType="tips" />
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">手机:</label>
        <div class="layui-input-block">
            <input name="mobile" placeholder="请输入手机" value="{if $manageInfo}{$manageInfo.mobile}{else/}{/if}" type="text" class="layui-input" maxlength="20" lay-verType="tips" />
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">邮箱:</label>
        <div class="layui-input-block">
            <input name="email" placeholder="请输入邮箱" value="{if $manageInfo}{$manageInfo.email}{else/}{/if}" type="text" class="layui-input" maxlength="20" lay-verType="tips" />
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">性别</label>
        <div class="layui-input-block">
            <input type="radio" name="sex" value="男" title="男" {if $manageInfo}{if ($manageInfo.sex == "男")}checked{/if}{else/}checked{/if}/>
            <input type="radio" name="sex" value="女" title="女" {if $manageInfo}{if ($manageInfo.sex == "女")}checked{/if}{else/}{/if}/>
        </div>
    </div>
    {if $manageInfo}
    <div class="layui-form-item">
        <label class="layui-form-label"></label>
        <div class="layui-form-mid layui-word-aux"><span style="color:red;">注意：</span>编辑账号的时候，如果密码为空则是不修改密码，否则，就是修改密码</div>
    </div>
    {/if}
</div>
</div>
</div>
</div>
<div class="submit-info text-center">
    <button class="layui-btn" lay-submit lay-filter="formSubmit">确认提交</button>
</div>
</div>
{include file="public/footer"/}
<script>
    layui.use(['layer', 'form'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var form = layui.form;
            form.on('submit(formSubmit)', function(data){
                layer.load(2);
                $.ajax({
                    type : 'post',
                    url : "{:url('/system.admin/userinfo')}",
                    data : data.field,
                    dataType : 'json',
                    success : function(res){
                        layer.closeAll('loading');
                        if(res.status){
                            layer.msg(res.msg, {icon: 1, time: 1000}, function(){
                                window.location.reload();
                            });
                        }else{
                            layer.msg(res.msg, {icon: 2, time: 1000});
                        }
                    },
                    error: function(e){
                        layer.closeAll('loading');
                        layer.msg("未知错误，操作中断！", {icon: 2, time: 1000});
                    }
                });
                return false;
            })
    });
</script>
</body>
</html>